package org.adorsys.aderp.aderplogin.client.common;

import java.io.Serializable;
import java.util.Map;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Oauth2User implements Serializable {
	
	private static final long serialVersionUID = -2281067286640333957L;

	private String username;
	
	private String oauthToken;
	
	private String selectedRole;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getSelectedRole() {
		return selectedRole;
	}

	public void setSelectedRole(String selectedRole) {
		this.selectedRole = selectedRole;
	}

	public String getOauthToken() {
		return oauthToken;
	}

	public void setOauthToken(String oauthToken) {
		this.oauthToken = oauthToken;
	}

	public static Oauth2User valueOf(Map<String, String> singleValueMap) {
		Oauth2User oauth2User = new Oauth2User();
		oauth2User.setUsername(singleValueMap.get("username"));
		oauth2User.setSelectedRole(singleValueMap.get("selectedRole"));
		oauth2User.setOauthToken(singleValueMap.get("oauthToken"));
		return oauth2User;
	}
}
